const state = {
	routerList: [],
	editableTabsValue: '',
	posts: [],
};
const getters = {

};
const actions = {};
const mutations = {
	setEditableTabsValue(state, val) {
		state.editableTabsValue = val;
	},
	// 获取菜单信息
	setRouterInfo(state, info) {
		let flag = state.routerList.findIndex((c) => c.name == info.name);
		try {
			flag == -1 && state.routerList.push(info);
		} catch (error) {
			this.$confirm( `登录信息已过期，请重新登录增值税管理系统`,'提示').then(data=>{
				try {
					Location.reload()
				} catch (error) {
				  
				}
			},err=>{
			  try {
					Location.reload()
				} catch (error) {
				  
				}
			})
		}
	},
	// 删除菜单信息
	removeTab(state, info) {
		state.routerList = info.tabs.filter((tab) => tab.name !== info.name);
	},
	// 删除 - 单纯列表
	removeTab2(state, name) {
		state.routerList = state.routerList.filter((tab) => tab.name !== name);
	},
	rightMenu(state, tabs) {
		state.routerList = tabs;
	},
	// 存入 当前机构岗位
	setPosts(state, posts) {
		state.posts = posts;
	},
	logOut(state) {
		state.routerList = [];
		state.posts = [];
		state.editableTabsValue = '';
	},
	
};
export default {
	namespaced: true,
	state,
	getters,
	actions,
	mutations,
};
